#pragma once
#include "C_ChemicalElement.h"

class C_PeriodicTable
{
private:
	std::vector<C_ChemicalElement*> m_elements;
public:
	C_PeriodicTable();
	C_PeriodicTable(std::string filename) { this->loadFromFile(filename); }
	~C_PeriodicTable();

	void loadFromFile(std::string filename);

	C_ChemicalElement* getById(int id) { return m_elements[id - 1]; }

	inline int size() { return m_elements.size(); }
	C_ChemicalElement* operator[](int index) { return m_elements[index]; }
private:
	void parseElement(json_t *data);
};

